'use strict'

define(['jquery', 'bootstrap', 'select2', 'datetimepicker', 'datetimepickerCN',
        'shiftform', 'validate', 'validate.en', 'location', 'area'], function($) {
  
  return {
        
    init: function() {
        this.initEdit();
        this.initEditAddress();
    },
    
    initEdit: function(){
        $(document).on("shown.bs.modal", "#mark", function(e) {
        var $form = $(e.currentTarget).find("form");
        
        $form.bt_validate();
      
        $form.shiftform({
            beforeSubmit: function(el) {
              $('form').trigger("validate.ajax.submit");
                   return $.bt_validate.result[$.bt_validate.form_id]
            }
        
        });
        
        })
        
    },
    
    initEditAddress: function(){
        $(document).on("shown.bs.modal", "#edit-address", function(e) {
        var $form = $(e.currentTarget).find("form");
        
        $form.bt_validate();
      
        $form.shiftform({
            beforeSubmit: function(el) {
              $('form').trigger("validate.ajax.submit");
                   return $.bt_validate.result[$.bt_validate.form_id]
            }
        
        });
        
        })
        
    },
    
   }
})
